<template>
<div class="itembox">
 
 <el-card class="box-card" shadow="hover">
  <div slot="header" class="clearfix">
    <span>{{title}}</span>
    <el-button style="float: right; padding: 3px 0" 
    type="text"
    @click="getartic">
    <span class="el-icon-zoom-in"></span> 查看全文...
    </el-button>
  </div>
  <div class="text">
      <img src="../../static/imgs/p01.jpg" alt="not find" class="clearfix">
      <div class="rightbox">
          <p>context</p>
          <h4>类型：{{artictype}}</h4>
          <h3>作者：{{uid}}</h3>
          <span>{{currentDate}}</span>
      </div>
  </div>
</el-card>
   

</div>
 

</template>

<script>
export default {
    name:'articleitem',
    props:{
      title:{
        type:String,
        default:'标题'
      },
      artictype:{
        type:String,
        default:'type'
      },
      uid:{
        type:Number,
        default:0
      },
      id:{
        type:Number,
         default:0
      }  

    },

    data() {
      return {
      currentDate: new Date()
    }
  },
  methods:{
    getartic(e){
      console.log("点击的文章为"+this.title);
      console.log('文章的ID为：'+this.id);
      this.$router.push({
         path:'/showartic',
         query:{
           arctic_id:this.id,
         }
      })
    }
  }
}
</script>

<style lang="less">
.itembox{
    text-align: start;
    margin: 20px 50px;
}
.itembox:hover{
     transform: translate(0,-2px);
    box-shadow:0 15px 30px rgba(0,0,0,.1);
}
.box-card {
    width: 100%;
    min-width: 400px;
    height: 250px;
  }
  .el-card__body{
      padding: 0;
  }
 .text {
    font-size: 14px;
    height: 200px;
    position: relative;
    display: flex;
    img{
        height: 100%;
        width: 40%;
        float: left;
        flex: 1;
    }
  }
  .rightbox{
    flex: 2;
    margin-left: 20px;
    // text-align: center;
    h3,h4{
       position: absolute;
       right: 30px;
       bottom: 30px;
    }
    h4{
        bottom: 50px;
    }
    p{
        height: 50%;
        margin-top: 10px;
    }
    span{
        position: absolute;
        bottom: 15px;
        right: 15px;
        font-size: 12px;
        color: cadetblue;
    }
}


  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }

  
</style>